//
//  PKMainController.m
//  Fanke
//
//  Created by sharayuki on 2017/8/14.
//  Copyright © 2017年 sharayuki. All rights reserved.
//

#import "PKMainController.h"
#import "PKPageContentView.h"
@interface PKMainController ()<PKPageContentViewDataSource,PKPageContentViewDelegate>
@property (strong,nonatomic)PKPageContentView *pageContentView;
@end

@implementation PKMainController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self setUI];
}
- (void)setUI{
    [self.view addSubview:[UIView new]];
    self.pageContentView = [[PKPageContentView alloc]init];
    
    //self.pageContentView.backgroundColor = [UIColor redColor];
    
    self.pageContentView.delegate = self;
    
    self.pageContentView.dataSource = self;
    
    [self.view addSubview:self.pageContentView];
    
    [self.pageContentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self.view);
        
        make.top.mas_equalTo(StatusBarHeight);
        
        make.bottom.mas_equalTo(-TabBarHeight);
        
    }];
    
    [self.pageContentView reloadData];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - pageContentView数据源代理 -
//返回item数
- (NSInteger)numberOfItemsInPageContentView:(PKPageContentView *)pageContentView{

    return 5;
}
//返回每个item的title
- (NSString *)pageContentView:(PKPageContentView *)pageContentView titleAtIndex:(NSInteger)index{

    NSArray *titleArr = @[@"关注",@"嘻哈",@"舞蹈",@"音乐",@"时尚"];
    
    return titleArr[index];
}
//返回单个内容视图
- (UIView *)pageContentView:(PKPageContentView *)pageContentView contentViewAtIndex:(NSInteger)index{

    UILabel *label = [UILabel new];
    
    label.text = [NSString stringWithFormat:@"内容第%zd页",index];
    
    return label;
}
// 提供pageBar选中视图
- (UIView *)selectedPageBarItemViewInPageContentView:(PKPageContentView *)pageContentView{

    return [UIView new];
}
- (CGFloat)pageBarHeightInPageContentView:(PKPageContentView *)pageContentView{

    return 30;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
